/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jpa.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author issao
 */
@Entity
@Table(name = "tipo_exame")
@NamedQueries({
    @NamedQuery(name = "TipoExame.findAll", query = "SELECT t FROM TipoExame t"),
    @NamedQuery(name = "TipoExame.findByIdTipoExame", query = "SELECT t FROM TipoExame t WHERE t.idTipoExame = :idTipoExame"),
    @NamedQuery(name = "TipoExame.findByDescricao", query = "SELECT t FROM TipoExame t WHERE t.descricao = :descricao"),
    @NamedQuery(name = "TipoExame.findByPreco", query = "SELECT t FROM TipoExame t WHERE t.preco = :preco")})
public class TipoExame implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_tipo_exame")
    private Integer idTipoExame;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "descricao")
    private String descricao;
    @Column(name = "preco")
    private Integer preco;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fkTipoExame")
    private Collection<Exame> exameCollection;

    public TipoExame() {
    }

    public TipoExame(Integer idTipoExame) {
        this.idTipoExame = idTipoExame;
    }

    public TipoExame(Integer idTipoExame, String descricao) {
        this.idTipoExame = idTipoExame;
        this.descricao = descricao;
    }

    public Integer getIdTipoExame() {
        return idTipoExame;
    }

    public void setIdTipoExame(Integer idTipoExame) {
        this.idTipoExame = idTipoExame;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public Integer getPreco() {
        return preco;
    }

    public void setPreco(Integer preco) {
        this.preco = preco;
    }

    public Collection<Exame> getExameCollection() {
        return exameCollection;
    }

    public void setExameCollection(Collection<Exame> exameCollection) {
        this.exameCollection = exameCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTipoExame != null ? idTipoExame.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoExame)) {
            return false;
        }
        TipoExame other = (TipoExame) object;
        if ((this.idTipoExame == null && other.idTipoExame != null) || (this.idTipoExame != null && !this.idTipoExame.equals(other.idTipoExame))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "jpa.entities.TipoExame[ idTipoExame=" + idTipoExame + " ]";
    }
    
}
